
document.write('<link rel="stylesheet" type="text/css" media="screen" href="scripts/jqgrid/theme/jquery-ui-1.8.11.custom.css" />');
document.write('<link rel="stylesheet" type="text/css" media="screen" href="scripts/jqgrid/theme/ui.jqgrid.css" />');
document.write('<link rel="stylesheet" type="text/css" media="screen" href="scripts/jqgrid/theme/jquery.ui.all.css" />');
document.write('<link rel="stylesheet" type="text/css" media="screen" href="scripts/jqgrid/theme/demos.css" />');
document.write('<script type="text/javascript" src="scripts/jqgrid/js/jquery-ui-1.8.2.custom.min.js"></script>');
document.write('<script type="text/javascript" src="scripts/jqgrid/js/grid.locale-cn.js"></script>');
document.write('<script type="text/javascript" src="scripts/jqgrid/js/jquery.jqGrid.min.js"></script>');
document.write('<script type="text/javascript" src="scripts/jqgrid/js/grid.setcolumns.js"></script>');

document.write('<script type="text/javascript" src="scripts/jqgrid/js/jquery.ui.core.js"></script>');
document.write('<script type="text/javascript" src="scripts/jqgrid/js/jquery.ui.widget.js"></script>');
document.write('<script type="text/javascript" src="scripts/jqgrid/js/jquery.ui.button.js"></script>');







function MyGrid(name,par){
	
	var settings = { 
		mtype:"POST",
		datatype: "json",
		jsonReader: { repeatitems : false, id: "0" }, 
		prmNames: {page:"_page",rows:"_rows", sort: "_sidx",order: "_sord", search:"_search", nd:"_nd",oper:"_oper", npage:null},
		viewrecords:true,
		multiselect: false,
		rowNum:10,
		rowList:[2,10,50]

	};

    jQuery.extend(settings, par);
    $.ajax({
           //提交数据的类型 POST GET
           type:"POST",
           //提交的网址
           url:settings.url,
           //提交的数据
           data:{
           },
           //返回数据的格式
           datatype: "json",//"xml", "html", "script", "json", "jsonp", "text".
           //在请求之前调用的函数
           //beforeSend:function(){$("#msg").html("logining");},
           //成功返回之后调用的函数            
           success:function(data){
           	if(data.trim()=="unlogin"){
           		window.location.href = "index.jsp";
           	}
           },
           //调用执行后调用的函数
           //调用出错执行的函数
           error: function(){
             // alert("服务器出现问题，请联系客服或稍后重试。");
           }       
        });
	return jQuery(name).jqGrid(settings);

}